package com.famous.dagligen.iterator.error;

/**
 * @author zhengdalong
 * @version V1.0
 * @date 2019/8/17 2:29 PM
 */

public class PancakeHouseMenu {

    private static final int MAX_ITEMS = 6;

    private int currentIndex = 0;

    private MenuItem[] menuItems = new MenuItem[6];

    public void addMenuItem(MenuItem menuItem) {
        if (currentIndex >= MAX_ITEMS) {
            throw new IllegalArgumentException("currentIndex >= MAX_ITEMS");
        }
        menuItems[currentIndex] = menuItem;
        currentIndex++;
    }

    public MenuItem[] getMenuItems() {
        return menuItems;
    }
}
